package cn.yuanqiao.web.controller.archive.storeRoom;

import cn.yuanqiao.archive.storeRoom.domain.Grid;
import cn.yuanqiao.archive.storeRoom.service.IWarehousePreviewService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.web.page.TableDataInfo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/archive/preview")
public class WarehousePreviewController extends BaseController {

    @Autowired
    private IWarehousePreviewService warehousePreviewService;


    @GetMapping("/html/{shelfId}")
    @PreAuthorize("@ss.hasPermi('archive:warehouseManagement:storeroom:list')")
    public AjaxResult warehouse(@PathVariable("shelfId") String shelfId){


       Map<String,String> map=warehousePreviewService.createStorageCubageHTML(shelfId);

       return AjaxResult.success(map);
    }
    @GetMapping("/getHtml/{shelfId}")
    @PreAuthorize("@ss.hasPermi('archive:warehouseManagement:storeroom:list')")
    public AjaxResult createStorageCubageHTMLB(@PathVariable("shelfId") String shelfId){

        Map<String,String> map=warehousePreviewService.createStorageCubageHTMLB(shelfId);

        return AjaxResult.success(map);
    }
    //获取库房详情
    @GetMapping("/getInfo/{gridId}")
    public AjaxResult getInfo(@PathVariable("gridId") Long gridId){
        Grid grid =warehousePreviewService.getInfo(gridId);
        return AjaxResult.success(grid);
    }

    @PostMapping("/getList")
    public TableDataInfo getList(@RequestBody Map map){
        startPage();
        List<Map<String,Object>> list = warehousePreviewService.selectDaList(map);
        return getDataTable(list);
    }

    /**
     * 档案树
     */
    @PostMapping("/getTreeList")
    public AjaxResult getTreeList(String id){
        List list=warehousePreviewService.getTreeList(id);
        return success(list);
    }





}
